package edu.sctu.zcy.month201505.subwaysystem.V3;

import java.util.HashMap;
import java.util.List;

/**
 * Created by user24 on 2015/6/5.
 */
public class DeductionsRules {


    public int getCountStation(String startStation,String endStation){


        HashMap<String,Integer> setStation = new MetroStation().stations;

        int start = setStation.get(startStation);
        int end = setStation.get(endStation);
        int count = 0;

        if (start > end){

            count = start - end;
        } else {
            count = end - start;
        }
        return count;
    }

    public int getPrice(int i){

        List<Passenger> passengers = new MetroStation().passengerList;
        String startStation = passengers.get(i).route.startStation;
        String endStation = passengers.get(i).route.endStation;

        int price = 2;

            if (getCountStation(startStation, endStation) < 3) {

                price = 2;

            } else if (getCountStation(startStation, endStation) >= 3 &&

                    getCountStation(startStation,endStation) < 6) {
                price = 4;
            } else if (getCountStation(startStation, endStation) >= 6 &&

                    getCountStation(startStation, endStation) < 8) {
                price = 5;
            } else {
                price = 6;
            }


        return price;
    }

}
